package bairui.international.model.domain.jpa;

import com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue;

/**
 *
 * (分公司员工提成记录)TB_BranchCompanyStaffRoyaltyRecord
 *
 * @说明
 * <pre>

 * </pre>
 *
 * @see Help_TB_BranchCompanyStaffRoyaltyRecord#inheritance() 继承体系信息
 *
 */
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate

@javax.persistence.Entity(name="t_branchCompanyStaffRoyaltyRecord")
@com.lianjing.sh.processing.info.annotation.GenerateInfoModel
@SuppressWarnings("serial")
@com.lianjing.sh.model.common.annotation.Comment("分公司员工提成记录")
@com.lianjing.sh.processing.info.annotation.InfoComment("分公司员工提成记录")
public class TB_BranchCompanyStaffRoyaltyRecord
 extends TBSuper_BaseIDAndTimeAndOrderValue
 implements 
	com.lianjing.sh.model.common.stardard.TableModel<Long>,
	java.io.Serializable

{

	
	
	/**
	 * 必须属性赋值接口
	 */
	public static interface MustProperties{
		/** 金额 */
		public Double getMoney();
		/** 产品订单 */
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder();
		/** 产品订单项 */
		public bairui.international.model.domain.jpa.TB_ProductOrderItem getProductOrderItem();
		/** 分公司员工 */
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaff getBranchCompanyStaff();
		/** 百分比 */
		public Double getRate();
	}
	
	/**
	 * 为必须属性赋值
	 */
	public TB_BranchCompanyStaffRoyaltyRecord properties(MustProperties properties) {
		this.setMoney(properties.getMoney());
		this.setProductOrder(properties.getProductOrder());
		this.setProductOrderItem(properties.getProductOrderItem());
		this.setBranchCompanyStaff(properties.getBranchCompanyStaff());
		this.setRate(properties.getRate());
		return this;
	}
	
	/**
	 *	必须属性构造函数
	 */
	public TB_BranchCompanyStaffRoyaltyRecord(MustProperties properties) {
		this.properties(properties);
	}
	
	
	/**
	 * 可选单属性赋值接口
	 */
	public static interface OptionalSingleProperties{
		/** 分公司员工金额记录 */
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord getBranchCompanyStaffMoneyRecord();
	}
	
	/**
	 * 为可选单属性赋值
	 */
	public TB_BranchCompanyStaffRoyaltyRecord properties(OptionalSingleProperties properties) {
		this.setBranchCompanyStaffMoneyRecord(properties.getBranchCompanyStaffMoneyRecord());
		return this;
	}
	
	
	
	public TB_BranchCompanyStaffRoyaltyRecord(MustProperties must, OptionalSingleProperties optionalSingle) {
		this.properties(must);
		this.properties(optionalSingle);
	}
	
	/**
	 * 仅当前必须属性赋值接口
	 */
	public static interface CurrentMustProperties{
		/** 金额 */
		public Double getMoney();
		/** 产品订单 */
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder();
		/** 产品订单项 */
		public bairui.international.model.domain.jpa.TB_ProductOrderItem getProductOrderItem();
		/** 分公司员工 */
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaff getBranchCompanyStaff();
		/** 百分比 */
		public Double getRate();
	}
	
	/**
	 * 为仅当前必须属性赋值
	 */
	public TB_BranchCompanyStaffRoyaltyRecord properties(CurrentMustProperties properties) {
		this.setMoney(properties.getMoney());
		this.setProductOrder(properties.getProductOrder());
		this.setProductOrderItem(properties.getProductOrderItem());
		this.setBranchCompanyStaff(properties.getBranchCompanyStaff());
		this.setRate(properties.getRate());
		return this;
	}
	
	/**
	 * 仅当前可选单属性赋值接口
	 */
	public static interface CurrentOptionalSingleProperties{
		/** 分公司员工金额记录 */
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord getBranchCompanyStaffMoneyRecord();
	}
	
	/**
	 * 为仅当前可选单属性赋值
	 */
	public TB_BranchCompanyStaffRoyaltyRecord properties(CurrentOptionalSingleProperties properties) {
		this.setBranchCompanyStaffMoneyRecord(properties.getBranchCompanyStaffMoneyRecord());
		return this;
	}
	
	public TB_BranchCompanyStaffRoyaltyRecord(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean,
		CurrentMustProperties mustProperties,
		CurrentOptionalSingleProperties optionalProperties
	) {
		this(bean);
		this.properties(mustProperties);
		this.properties(optionalProperties);
	}
	
	public TB_BranchCompanyStaffRoyaltyRecord(
		@lombok.NonNull com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean
	) {
		update(bean);
	}
	
	public TB_BranchCompanyStaffRoyaltyRecord update(com.lianjing.sh.model.uml.model.data.TBSuper_BaseIDAndTimeAndOrderValue bean){
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		return this;
	}
	
	
	/**
	 * 更新属性内部类
	 */
	public abstract class UpdateProperties {
	
		public UpdateProperties() throws Exception {
			Integer orderValue = getOrderValue(TB_BranchCompanyStaffRoyaltyRecord.this);
			if(isOverride_getOrderValue){
				TB_BranchCompanyStaffRoyaltyRecord.this.setOrderValue(orderValue);
			}
	
			Double money = getMoney(TB_BranchCompanyStaffRoyaltyRecord.this);
			if(isOverride_getMoney){
				TB_BranchCompanyStaffRoyaltyRecord.this.setMoney(money);
			}
	
			bairui.international.model.domain.jpa.TB_ProductOrder productOrder = getProductOrder(TB_BranchCompanyStaffRoyaltyRecord.this);
			if(isOverride_getProductOrder){
				TB_BranchCompanyStaffRoyaltyRecord.this.setProductOrder(productOrder);
			}
	
			bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord branchCompanyStaffMoneyRecord = getBranchCompanyStaffMoneyRecord(TB_BranchCompanyStaffRoyaltyRecord.this);
			if(isOverride_getBranchCompanyStaffMoneyRecord){
				TB_BranchCompanyStaffRoyaltyRecord.this.setBranchCompanyStaffMoneyRecord(branchCompanyStaffMoneyRecord);
			}
	
			bairui.international.model.domain.jpa.TB_ProductOrderItem productOrderItem = getProductOrderItem(TB_BranchCompanyStaffRoyaltyRecord.this);
			if(isOverride_getProductOrderItem){
				TB_BranchCompanyStaffRoyaltyRecord.this.setProductOrderItem(productOrderItem);
			}
	
			bairui.international.model.domain.jpa.TB_BranchCompanyStaff branchCompanyStaff = getBranchCompanyStaff(TB_BranchCompanyStaffRoyaltyRecord.this);
			if(isOverride_getBranchCompanyStaff){
				TB_BranchCompanyStaffRoyaltyRecord.this.setBranchCompanyStaff(branchCompanyStaff);
			}
	
			Double rate = getRate(TB_BranchCompanyStaffRoyaltyRecord.this);
			if(isOverride_getRate){
				TB_BranchCompanyStaffRoyaltyRecord.this.setRate(rate);
			}
		}
	
		public TB_BranchCompanyStaffRoyaltyRecord up(){
			return TB_BranchCompanyStaffRoyaltyRecord.this;
		}
	
		/** 排序值 */
		private boolean isOverride_getOrderValue = true;
		public Integer getOrderValue(TB_BranchCompanyStaffRoyaltyRecord it) throws Exception { 
			isOverride_getOrderValue = false; 
			return null;
		}
		/** 金额 */
		private boolean isOverride_getMoney = true;
		public Double getMoney(TB_BranchCompanyStaffRoyaltyRecord it) throws Exception { 
			isOverride_getMoney = false; 
			return null;
		}
		/** 产品订单 */
		private boolean isOverride_getProductOrder = true;
		public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder(TB_BranchCompanyStaffRoyaltyRecord it) throws Exception { 
			isOverride_getProductOrder = false; 
			return null;
		}
		/** 分公司员工金额记录 */
		private boolean isOverride_getBranchCompanyStaffMoneyRecord = true;
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord getBranchCompanyStaffMoneyRecord(TB_BranchCompanyStaffRoyaltyRecord it) throws Exception { 
			isOverride_getBranchCompanyStaffMoneyRecord = false; 
			return null;
		}
		/** 产品订单项 */
		private boolean isOverride_getProductOrderItem = true;
		public bairui.international.model.domain.jpa.TB_ProductOrderItem getProductOrderItem(TB_BranchCompanyStaffRoyaltyRecord it) throws Exception { 
			isOverride_getProductOrderItem = false; 
			return null;
		}
		/** 分公司员工 */
		private boolean isOverride_getBranchCompanyStaff = true;
		public bairui.international.model.domain.jpa.TB_BranchCompanyStaff getBranchCompanyStaff(TB_BranchCompanyStaffRoyaltyRecord it) throws Exception { 
			isOverride_getBranchCompanyStaff = false; 
			return null;
		}
		/** 百分比 */
		private boolean isOverride_getRate = true;
		public Double getRate(TB_BranchCompanyStaffRoyaltyRecord it) throws Exception { 
			isOverride_getRate = false; 
			return null;
		}
	
	}
	
	
	/**
	 * 构造函数
	 */
	public TB_BranchCompanyStaffRoyaltyRecord() {
	}
	
	public TB_BranchCompanyStaffRoyaltyRecord(
		@lombok.NonNull Long id
	) {
		this.setId(id);
	}
	
	public TB_BranchCompanyStaffRoyaltyRecord(
		@lombok.NonNull TB_BranchCompanyStaffRoyaltyRecord bean
	) {
		this.setId(bean.getId());
		this.setCreateTime(bean.getCreateTime());
		this.setModifyTime(bean.getModifyTime());
		this.setOrderValue(bean.getOrderValue());
		this.setMoney(bean.getMoney());
		this.setProductOrder(bean.getProductOrder());
		this.setBranchCompanyStaffMoneyRecord(bean.getBranchCompanyStaffMoneyRecord());
		this.setProductOrderItem(bean.getProductOrderItem());
		this.setBranchCompanyStaff(bean.getBranchCompanyStaff());
		this.setRate(bean.getRate());
	}
	
	

	


	/**
	 * 属性
	 */
	@com.lianjing.sh.model.common.annotation.Comment("金额")
	@com.lianjing.sh.processing.info.annotation.InfoComment("金额")
	@javax.persistence.Column(name="money", nullable=false)
	private Double money;

	@com.lianjing.sh.model.common.annotation.Comment("产品订单")
	@com.lianjing.sh.processing.info.annotation.InfoComment("产品订单")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_ProductOrder productOrder;

	@com.lianjing.sh.model.common.annotation.Comment("分公司员工金额记录")
	@com.lianjing.sh.processing.info.annotation.InfoComment("分公司员工金额记录")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToOne(mappedBy="branchCompanyStaffRoyaltyRecord")
	private bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord branchCompanyStaffMoneyRecord;

	@com.lianjing.sh.model.common.annotation.Comment("产品订单项")
	@com.lianjing.sh.processing.info.annotation.InfoComment("产品订单项")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.OneToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_ProductOrderItem productOrderItem;

	@com.lianjing.sh.model.common.annotation.Comment("分公司员工")
	@com.lianjing.sh.processing.info.annotation.InfoComment("分公司员工")
	@com.querydsl.core.annotations.QueryInit("*.*.*")
	@javax.persistence.ManyToOne(optional=false)
	private bairui.international.model.domain.jpa.TB_BranchCompanyStaff branchCompanyStaff;

	@com.lianjing.sh.model.common.annotation.Comment("百分比")
	@com.lianjing.sh.processing.info.annotation.InfoComment("百分比")
	@javax.persistence.Column(name="rate", nullable=false)
	private Double rate;

	/** get[金额] */
	public Double getMoney() {
		return this.money;
	}

	/** get[产品订单] */
	public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder() {
		return this.productOrder;
	}

	/** get[分公司员工金额记录] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord getBranchCompanyStaffMoneyRecord() {
		return this.branchCompanyStaffMoneyRecord;
	}

	/** get[产品订单项] */
	public bairui.international.model.domain.jpa.TB_ProductOrderItem getProductOrderItem() {
		return this.productOrderItem;
	}

	/** get[分公司员工] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaff getBranchCompanyStaff() {
		return this.branchCompanyStaff;
	}

	/** get[百分比] */
	public Double getRate() {
		return this.rate;
	}

	/** set[金额] */
	public void setMoney(Double money) {
		this.money = money;
	}

	/** set[产品订单] */
	public void setProductOrder(bairui.international.model.domain.jpa.TB_ProductOrder productOrder) {
		this.productOrder = productOrder;
	}

	/** set[分公司员工金额记录] */
	public void setBranchCompanyStaffMoneyRecord(bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord branchCompanyStaffMoneyRecord) {
		this.branchCompanyStaffMoneyRecord = branchCompanyStaffMoneyRecord;
	}

	/** set[产品订单项] */
	public void setProductOrderItem(bairui.international.model.domain.jpa.TB_ProductOrderItem productOrderItem) {
		this.productOrderItem = productOrderItem;
	}

	/** set[分公司员工] */
	public void setBranchCompanyStaff(bairui.international.model.domain.jpa.TB_BranchCompanyStaff branchCompanyStaff) {
		this.branchCompanyStaff = branchCompanyStaff;
	}

	/** set[百分比] */
	public void setRate(Double rate) {
		this.rate = rate;
	}

	public void assignProductOrder(bairui.international.model.domain.jpa.TB_ProductOrder productOrder) {
		if(null != productOrder){
			productOrder.addBranchCompanyStaffRoyaltyRecords(this);
		}
		this.setProductOrder(productOrder);
	}
	

	public void assignBranchCompanyStaffMoneyRecord(bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord branchCompanyStaffMoneyRecord) {
		if(null != branchCompanyStaffMoneyRecord){
			branchCompanyStaffMoneyRecord.setBranchCompanyStaffRoyaltyRecord(this);
		}
		this.setBranchCompanyStaffMoneyRecord(branchCompanyStaffMoneyRecord);
	}
	

	public void assignProductOrderItem(bairui.international.model.domain.jpa.TB_ProductOrderItem productOrderItem) {
		if(null != productOrderItem){
			productOrderItem.setBranchCompanyStaffRoyaltyRecord(this);
		}
		this.setProductOrderItem(productOrderItem);
	}
	

	public void assignBranchCompanyStaff(bairui.international.model.domain.jpa.TB_BranchCompanyStaff branchCompanyStaff) {
		if(null != branchCompanyStaff){
			branchCompanyStaff.addBranchCompanyStaffRoyaltyRecords(this);
		}
		this.setBranchCompanyStaff(branchCompanyStaff);
	}
	

	
	
	

	/** take[产品订单] */
	public bairui.international.model.domain.jpa.TB_ProductOrder takeProductOrder(){
		if(null == this.productOrder){
			this.productOrder = new bairui.international.model.domain.jpa.TB_ProductOrder();
		}
		return this.productOrder;
	}
	
	/** take[分公司员工金额记录] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord takeBranchCompanyStaffMoneyRecord(){
		if(null == this.branchCompanyStaffMoneyRecord){
			this.branchCompanyStaffMoneyRecord = new bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord();
		}
		return this.branchCompanyStaffMoneyRecord;
	}
	
	/** take[产品订单项] */
	public bairui.international.model.domain.jpa.TB_ProductOrderItem takeProductOrderItem(){
		if(null == this.productOrderItem){
			this.productOrderItem = new bairui.international.model.domain.jpa.TB_ProductOrderItem();
		}
		return this.productOrderItem;
	}
	
	/** take[分公司员工] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaff takeBranchCompanyStaff(){
		if(null == this.branchCompanyStaff){
			this.branchCompanyStaff = new bairui.international.model.domain.jpa.TB_BranchCompanyStaff();
		}
		return this.branchCompanyStaff;
	}
	
	/** must[产品订单] */
	public bairui.international.model.domain.jpa.TB_ProductOrder mustProductOrder() {
		return this.productOrder;
	}
	
	/** must[产品订单项] */
	public bairui.international.model.domain.jpa.TB_ProductOrderItem mustProductOrderItem() {
		return this.productOrderItem;
	}
	
	/** must[分公司员工] */
	public bairui.international.model.domain.jpa.TB_BranchCompanyStaff mustBranchCompanyStaff() {
		return this.branchCompanyStaff;
	}
	
	/** optional[分公司员工金额记录] */
	public java.util.Optional<bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord> optionalBranchCompanyStaffMoneyRecord() {
		return java.util.Optional.ofNullable(this.branchCompanyStaffMoneyRecord);
	}
	

	/**
	 * 复写 hashCode
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		return prime * result + ((this.getId() == null) ? 0 : this.getId().hashCode());
	}
	
	/**
	 * 复写 equals
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj == null){
			return false;
		}
		if (getClass() != obj.getClass()){
			return false;
		}
		TB_BranchCompanyStaffRoyaltyRecord other = (TB_BranchCompanyStaffRoyaltyRecord) obj;
		if (this.getId() == null) {
			return false;
		} else if (!this.getId().equals(other.getId())){
			return false;
		}
		return true;
	}
	

	/**
	 * 用来覆盖toString()的输出
	 */
	@javax.persistence.Transient
	private String toString;
	
	public void setToString(String toString) {
		this.toString = toString;
	}
	
	/**
	 * 复写 toString
	 */
	@Override
	public String toString() {
		if(null != this.toString){
			return this.toString;
		}
		return super.toString();
	}	

	@javax.persistence.PrePersist
	public void prePersist() {
		this.setCreateTime(new java.util.Date());
		this.setModifyTime(new java.util.Date());
	}
	
	@javax.persistence.PreUpdate
	public void preUpdate() {
		this.setModifyTime(new java.util.Date());
	}



}
